# 导入redis配置
from redis import StrictRedis


class Config:
    DEBUG = None
    # ipython
    # import os,base64
    # a=os.urandom(32)
    # b=base64.b64encode(a)
    # print(b)
    SECRET_KEY = '9k8zhrOkNQ7utFcrRokenWS7j56qZhrxQ2ElNQEzVuk='

    # 配置数据库连接信息和动态追踪信息修改
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql1@localhost/info3'
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    # 配置redis连接信息
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379
    SESSION_TYPE = 'redis'
    SESSION_REDIS = StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    # 签名
    SESSION_USE_SIGNR = True
    # 配置session的过期时间
    PERMANENT_SESSION_LIFETIME = 86400


class development(Config):  # 开发模式下
    DEBUG = True


class production(Config):  # 生产模式下
    DEBUG = False


config = {
    'dev': development,
    'pro': production
}
